package com.burgeon.backend.SHOPBACKEND.controller;
/**
 * 社群营销
 */

import com.burgeon.backend.SHOPBACKEND.entity.socialMarketing.SocialListVO;
import com.burgeon.backend.SHOPBACKEND.entity.socialMarketing.SocialMarketingVO;
import com.burgeon.backend.SHOPBACKEND.service.BackendSocialMarketingService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("backend/social")
public class BackendSocialMarketingController extends BaseController {

    @Autowired
    private BackendSocialMarketingService backendSocialMarketingService;

    //营销列表头部
    @RequestMapping("headData")
    public ResponseResult<HashMap> headData(String account) {

        HashMap data = backendSocialMarketingService.headData(account);

        return new ResponseResult<HashMap>(SUCCESS,data);
    }

    /**
     *社群营销列表
     * @param startTime 可不传 8位
     * @param endTime 可不传 8位
     *
     * @param start 20
     * @param field A 员工 B店仓 C无条件
     * @param value
     * @param account
     * @return
     */
    @RequestMapping("socialListData")
    public ResponseResult<List<SocialListVO>> socialListData(String startTime, String endTime, Integer start, String field, String value, String account) {
        List<SocialListVO> data = backendSocialMarketingService.socialListData(startTime, endTime, start, field, value, account);
        return new ResponseResult<List<SocialListVO>>(SUCCESS,data);
    }

    /**
     * 任务监控页面
     * @param time 8位
     * @param start
     * @param field  A 导购名 B店名 C无条件 D是否完成
     * @param value
     * @param account
     * @param finish 是否完成 Y N
     * @return
     */
    @RequestMapping("monitoring")
    public ResponseResult<List<SocialMarketingVO>> getData(String finish, String time, Integer start, String field, String value, String account) {
        List<SocialMarketingVO> data = backendSocialMarketingService.getShareTaskMonitoring(finish,time, start, field, value, account);
        return new ResponseResult<List<SocialMarketingVO>>(SUCCESS,data);
    }

    /**
     * 配置任务
     * @param num
     * @param isUse
     * @param account
     * @return
     */
    @RequestMapping("config")
    public ResponseResult<Void> config(Integer num, String isUse, String account) {
        backendSocialMarketingService.upShareTaskConfig(num,isUse,account);
        return new ResponseResult<>(SUCCESS);
    }

    @RequestMapping("configData")
    public ResponseResult<HashMap> configData(String account) {
        HashMap data = backendSocialMarketingService.configData(account);
        return new ResponseResult<HashMap>(SUCCESS,data);
    }

}
